package cn.stylefeng.guns.modular.biz.controller;

import cn.stylefeng.guns.modular.biz.entity.WmInventoryQty;
import cn.stylefeng.guns.modular.biz.pojo.request.WmInventoryQtyRequest;
import cn.stylefeng.guns.modular.biz.service.WmInventoryQtyService;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.List;

/**
 * 煤场库存（按批次/量管理）控制器
 *
 * @author 张朋飞
 * @since 2024/09/13 16:37
 */
@RestController
@ApiResource(name = "煤场库存（按批次/量管理）")
public class WmInventoryQtyController {

    @Resource
    private WmInventoryQtyService wmInventoryQtyService;

    /**
     * 添加煤场库存（按批次/量管理）
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @PostResource(name = "添加煤场库存（按批次/量管理）", path = "/wmInventoryQty/add")
    public ResponseData<WmInventoryQty> add(@RequestBody @Validated(WmInventoryQtyRequest.add.class) WmInventoryQtyRequest wmInventoryQtyRequest) {
        wmInventoryQtyService.add(wmInventoryQtyRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 删除煤场库存（按批次/量管理）
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @PostResource(name = "删除煤场库存（按批次/量管理）", path = "/wmInventoryQty/delete")
    public ResponseData<?> delete(@RequestBody @Validated(WmInventoryQtyRequest.delete.class) WmInventoryQtyRequest wmInventoryQtyRequest) {
        wmInventoryQtyService.del(wmInventoryQtyRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 批量删除煤场库存（按批次/量管理）
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @PostResource(name = "批量删除煤场库存（按批次/量管理）", path = "/wmInventoryQty/batchDelete")
    public ResponseData<?> batchDelete(@RequestBody @Validated(BaseRequest.batchDelete.class) WmInventoryQtyRequest wmInventoryQtyRequest) {
        wmInventoryQtyService.batchDelete(wmInventoryQtyRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑煤场库存（按批次/量管理）
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @PostResource(name = "编辑煤场库存（按批次/量管理）", path = "/wmInventoryQty/edit")
    public ResponseData<?> edit(@RequestBody @Validated(WmInventoryQtyRequest.edit.class) WmInventoryQtyRequest wmInventoryQtyRequest) {
        wmInventoryQtyService.edit(wmInventoryQtyRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 查看煤场库存（按批次/量管理）详情
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @GetResource(name = "查看煤场库存（按批次/量管理）详情", path = "/wmInventoryQty/detail")
    public ResponseData<WmInventoryQty> detail(@Validated(WmInventoryQtyRequest.detail.class) WmInventoryQtyRequest wmInventoryQtyRequest) {
        return new SuccessResponseData<>(wmInventoryQtyService.detail(wmInventoryQtyRequest));
    }

    /**
     * 获取煤场库存（按批次/量管理）列表
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @GetResource(name = "获取煤场库存（按批次/量管理）列表", path = "/wmInventoryQty/list")
    public ResponseData<List<WmInventoryQty>> list(WmInventoryQtyRequest wmInventoryQtyRequest) {
        return new SuccessResponseData<>(wmInventoryQtyService.findList(wmInventoryQtyRequest));
    }

    /**
     * 获取煤场库存（按批次/量管理）列表（带分页）
     *
     * @author 张朋飞
     * @since 2024/09/13 16:37
     */
    @GetResource(name = "获取煤场库存（按批次/量管理）列表（带分页）", path = "/wmInventoryQty/page")
    public ResponseData<PageResult<WmInventoryQty>> page(WmInventoryQtyRequest wmInventoryQtyRequest) {
        return new SuccessResponseData<>(wmInventoryQtyService.findPage(wmInventoryQtyRequest));
    }



}
